package com.example.smartrefreshdemo

import com.example.smartrefreshdemo.adapter.Diff

data class ItemData(var title: String, var ds: String) : Diff {
    override fun toString(): String {
        return "title:${title} ds:${ds}"
    }

    override fun isSameObject(other: Any): Boolean {
        if (other is ItemData) {
            if (title == other.title)
                return true
        }
        return hasSameContent(other)
    }

    override fun hasSameContent(other: Any): Boolean {
        if (other is ItemData) {
            if (title == other.title && ds == other.ds)
                return true
        }
        return false
    }

    override fun diff(other: Any): Any? {
        if (other is ItemData) {
            return other.toString()
        }
        return null
    }
}